package com.stellar.circle.basic.service.impl;

import com.stellar.circle.basic.dao.SCommentDao;
import com.stellar.circle.basic.entity.SComment;
import com.stellar.circle.basic.service.SCommentService;
import com.stellar.circle.constants.CircleConstants;
import com.stellar.circle.controller.admin.sComment.vo.CommentStatistics;
import com.stellar.circle.controller.admin.sComment.vo.DailyCommentStatisticsVO;
import com.stellar.circle.controller.admin.sComment.vo.SCommentBaseVO;
import com.stellar.circle.controller.admin.sComment.vo.SCommentWithUserInfo;
import com.stellar.web.core.enums.IsDeletedFlagEnum;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Set;

/**
 * 评论表(SComment)服务实现
 *
 * @author Jqchan
 * @since 2025-05-19 14:52:26
 */
@Service
public class SCommentServiceImpl implements SCommentService {

    @Resource
    private SCommentDao sCommentDao;

    @Override
    public SComment queryById(Long id) {
        return sCommentDao.queryById(id);
    }

    @Override
    public SComment queryByCondition(SComment condition) {
        return sCommentDao.queryByCondition(condition);
    }

    @Override
    public List<SComment> queryAllByCondition(SComment condition) {
        return sCommentDao.queryAllByCondition(condition);
    }

    @Override
    public List<SComment> page(SComment condition, int page, int pageSize) {
        return sCommentDao.page(condition, page, pageSize);
    }

    @Override
    public int insert(SComment entity) {
        return sCommentDao.insert(entity);
    }

    @Override
    public int update(SComment entity) {
        return sCommentDao.update(entity);
    }

    @Override
    public int deleteById(Long id) {
        return sCommentDao.deleteById(id);
    }

    @Override
    public Long count(SComment condition) {
        return sCommentDao.count(condition);
    }


    @Override
    public List<SComment> batchQueryByParentIds(Set<Long> parentCommentIds) {
        return sCommentDao.batchQueryByParentIds(parentCommentIds);
    }

    @Override
    public CommentStatistics getCommentStatistics(LocalDateTime prevBeginTime, LocalDateTime prevEndTime, String sourceType, Integer isAnonymous, String commentStatus) {
        return sCommentDao.getCommentStatistics(prevBeginTime, prevEndTime, sourceType, isAnonymous, commentStatus);
    }

    @Override
    public List<DailyCommentStatisticsVO> getDailyCommentCounts(LocalDateTime startDate, LocalDateTime endDate) {
        return sCommentDao.getDailyCommentCounts(startDate, endDate);
    }

    @Override
    public void updateReplyCount(Long parentId, int delta) {
        sCommentDao.updateReplyCount(parentId, delta);
    }

    @Override
    public List<SCommentWithUserInfo> selectAllCommentsWithUserInfo(String sourceType, Long sourceId) {
        return sCommentDao.selectAllCommentsWithUserInfo(sourceType, sourceId);
    }

    @Override
    public List<SCommentWithUserInfo> selectRootComments(String sourceType, Long sourceId) {
        return sCommentDao.selectRootComments(sourceType, sourceId);
    }

}
